<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,IE=9,chrome=1"><meta name="generator" content="MATLAB 2021b"><title>Get Started with ROS</title><style type="text/css">.rtcContent { padding: 30px; } .S0 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 28.8px; min-height: 0px; white-space: pre-wrap; color: rgb(213, 80, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 24px; font-weight: 400; text-align: left;  }
.S1 { margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;  }
.S2 { margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;  }
.S3 { margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;  }
.S4 { margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left;  }
.S5 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: 700; text-align: left;  }
.CodeBlock { background-color: #F7F7F7; margin: 10px 0 10px 0;}
.S6 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 4px 4px 0px 0px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S7 { color: rgb(64, 64, 64); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px;  }
/* Styling that is common to warnings and errors is in diagnosticOutput.css */.embeddedOutputsErrorElement {    min-height: 18px;    max-height: 550px;}
.embeddedOutputsErrorElement .diagnosticMessage-errorType {    overflow: auto;}
.embeddedOutputsErrorElement.inlineElement {}
.embeddedOutputsErrorElement.rightPaneElement {}
/* Styling that is common to warnings and errors is in diagnosticOutput.css */.embeddedOutputsWarningElement {    min-height: 18px;    max-height: 550px;}
.embeddedOutputsWarningElement .diagnosticMessage-warningType {    overflow: auto;}
.embeddedOutputsWarningElement.inlineElement {}
.embeddedOutputsWarningElement.rightPaneElement {}
/* Copyright 2015-2019 The MathWorks, Inc. *//* In this file, styles are not scoped to rtcContainer since they could be in the Dojo Tooltip */.diagnosticMessage-wrapper {    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;    font-size: 12px;}
.diagnosticMessage-wrapper.diagnosticMessage-warningType {    color: rgb(255,100,0);}
.diagnosticMessage-wrapper.diagnosticMessage-warningType a {    color: rgb(255,100,0);    text-decoration: underline;}
.diagnosticMessage-wrapper.diagnosticMessage-errorType {    color: rgb(230,0,0);}
.diagnosticMessage-wrapper.diagnosticMessage-errorType a {    color: rgb(230,0,0);    text-decoration: underline;}
.diagnosticMessage-wrapper .diagnosticMessage-messagePart,.diagnosticMessage-wrapper .diagnosticMessage-causePart {    white-space: pre-wrap;}
.diagnosticMessage-wrapper .diagnosticMessage-stackPart {    white-space: pre;}
.embeddedOutputsTextElement,.embeddedOutputsVariableStringElement {    white-space: pre;    word-wrap:  initial;    min-height: 18px;    max-height: 550px;}
.embeddedOutputsTextElement .textElement,.embeddedOutputsVariableStringElement .textElement {    overflow: auto;}
.textElement,.rtcDataTipElement .textElement {    padding-top: 3px;}
.embeddedOutputsTextElement.inlineElement,.embeddedOutputsVariableStringElement.inlineElement {}
.inlineElement .textElement {}
.embeddedOutputsTextElement.rightPaneElement,.embeddedOutputsVariableStringElement.rightPaneElement {    min-height: 16px;}
.rightPaneElement .textElement {    padding-top: 2px;    padding-left: 9px;}
.S8 { margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;  }
.S9 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 4px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S10 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }</style></head><body><div class = rtcContent><h1  class = 'S0'><span>Get Started with ROS</span></h1><div  class = 'S1'><span>机器人操作系统（Robot Operating System，ROS）是一个通信接口，它使机器人系统的不同部分能够相互发现，并在它们之间发送和接收数据。MATLAB®支持具有函数库的ROS，使您能够与启用ROS的物理机器人或机器人仿真器（如Gazebo®）交换数据。</span></div><div  class = 'S1'><span>此示例介绍如何：</span></div><ul  class = 'S2'><li  class = 'S3'><span>在 MATLAB中设置ROS</span></li><li  class = 'S3'><span>获取有关ROS网络中功能的信息</span></li><li  class = 'S3'><span>获取ROS messages的信息</span></li></ul><h2  class = 'S4'><span>ROS Terminology</span></h2><ul  class = 'S2'><li  class = 'S3'><span>ROS网络(</span><span style=' font-style: italic;'>ROS network)</span><span>包括通过ROS通信的机器人系统的不同部分（例如计划者planner或相机接口）。网络可以分布在多台机器上。</span></li><li  class = 'S3'><span>ROS主机(</span><span style=' font-style: italic;'>ROS master</span><span> )负责协调ROS网络的不同部分。它由</span><span style=' font-style: italic;'>Master URI</span><span>（统一资源标识符）标识，该URI指定运行主服务器的计算机的主机名或IP地址。</span></li><li  class = 'S3'><span>ROS节点(</span><span style=' font-style: italic;'>ROS node</span><span>)包含相关ROS功能的集合（例如发布者publishers、订阅者subscribers和服务services）。ROS网络可以有许多ROS节点nodes。</span></li><li  class = 'S3'><span>发布者</span><span style=' font-style: italic;'>Publishers</span><span>、订阅者</span><span style=' font-style: italic;'>subscribers</span><span>和服务</span><span style=' font-style: italic;'>services</span><span>是处理数据的不同类型的ROS实体。他们用信息交换数据</span><span style=' font-style: italic;'>messages</span><span>。</span></li><li  class = 'S3'><span>发布者publisher向特定主题</span><span style=' font-style: italic;'>topic</span><span>发送消息（如“odometry”），该主题的订阅者subscribers接收这些消息。一个主题可以与多个发布者和订阅者关联。</span></li></ul><div  class = 'S1'><span>有关更多信息，请参阅ROS网站上的</span><a href = "docid:ros_gs.mw_79ccfff3-bdbd-46d8-899f-e5add5a50fad"><span>Robot Operating System (ROS)</span></a><span>（ROS）和概念</span><a href = "https://wiki.ros.org/ROS/Concepts"><span>Concepts</span></a><span>部分。</span></div><h2  class = 'S5'><span>Initialize ROS Network</span></h2><div  class = 'S1'><span>使用 </span><span style=' font-family: monospace;'></span><a href = "docid:ros_ref.bupf5_j_1"><span style=' font-family: monospace;'>rosinit</span></a><span> 初始化ROS。默认情况下，</span><span style=' font-family: monospace;'>rosinit</span><span>在MATLAB中创建ROS主节点(</span><span style=' font-style: italic;'>ROS master)</span><span>,并启动连接到该主节点(</span><span style=' font-style: italic;'>ROS master)</span><span>的全局节点(</span><span style=' font-style: italic;'>global node</span><span>)。全局节点(</span><span style=' font-style: italic;'>ROS master)</span><span>被其他ROS函数自动使用。</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >rosinit</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="BDEC71F2" data-testid="output_0" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="61" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">Launching ROS Core...
................Done in 3.1564 seconds.
Initializing ROS master on http://192.168.118.1:11311.
Initializing global node /matlab_global_node_08796 with NodeURI http://LAPTOP-TG3AQJDL:14250/</div></div></div></div></div><div  class = 'S8'><span>使用</span><a href = "docid:ros_ref.bupf5_j_4"><span style=' font-family: monospace;'>rosnode</span></a><span style=' font-family: monospace;'> list</span><span>查看ROS网络中的所有节点。注意，唯一可用的节点是</span><span style=' font-family: monospace;'>rosinit</span><span>创建的全局节点(global node)。</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >rosnode </span><span style="color: rgb(170, 4, 249);">list</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="E7AB0354" data-testid="output_1" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="18" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">/matlab_global_node_08796</div></div></div></div></div><div  class = 'S8'><span>使用</span><span style=' font-family: monospace;'>exampleHelperROSCreateSampleNetwork</span><span>向ROS网络填充三个附加节点以及示例发布者(publishers)和订阅者(subscribers)。</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S9'><span style="white-space: pre"><span >exampleHelperROSCreateSampleNetwork</span></span></div></div></div><div  class = 'S8'><span>再次使用 rosnode</span><span style=' font-family: monospace;'> list</span><span> 查看三个新节点 </span><span>(</span><span style=' font-family: monospace;'>node_1</span><span>,</span><span> </span><span style=' font-family: monospace;'>node_2,</span><span> and</span><span> </span><span style=' font-family: monospace;'>node_3</span><span>)。</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >rosnode </span><span style="color: rgb(170, 4, 249);">list</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="5812EFFE" data-testid="output_2" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="61" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">/matlab_global_node_08796
/node_1
/node_2
/node_3</div></div></div></div></div><div  class = 'S8'><span>该图显示了ROS网络的当前状态。MATLAB全局节点(global node)已断开连接，因为它当前没有任何发布者（publishers）、订阅者（subscribers）或服务（services）。</span></div><div  class = 'S1'><img class = "imageNode" src = "" width = "638" height = "362" alt = "" style = "vertical-align: baseline; width: 638px; height: 362px;"></img></div><h2  class = 'S5'><span>Topics</span></h2><div  class = 'S1'><span> 使用</span><a href = "docid:ros_ref.bupf5_j_14"><span style=' font-family: monospace;'>rostopic</span></a><span>列表查看ROS网络中的可用主题。有三个活动主题：</span><span style=' font-family: monospace;'>/pose</span><span>, </span><span style=' font-family: monospace;'>/rosout</span><span>, and </span><span style=' font-family: monospace;'>/scan</span><span>。默认的日志主题，</span><span style=' font-family: monospace;'>rosout</span><span>，总是出现在ROS网络中。其他两个主题是作为示例网络的一部分创建的。</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >rostopic </span><span style="color: rgb(170, 4, 249);">list</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="B032B18E" data-testid="output_3" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="61" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">/pose  
/rosout
/scan  
/tf    </div></div></div></div></div><div  class = 'S8'><span>使用 </span><span style=' font-family: monospace;'>rostopic info</span><span> </span><span style=' font-style: italic; font-family: monospace;'>&lt;topicname&gt;</span><span>获取有关特定主题的特定信息。 面的命令显示 </span><span style=' font-family: monospace;'>/node_1</span><span> 发布 (发送消息到) the</span><span> </span><span style=' font-family: monospace;'>/pose</span><span> topic, and</span><span> </span><span style=' font-family: monospace;'>/node_2</span><span> 订阅 (从接收消息) to that topic. 有关详细信息，请参阅</span><a href = "docid:ros_ug.mw_fa34dc6f-351e-4ab5-8680-46563496814b"><span>Exchange Data with ROS Publishers and Subscribers。</span></a></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >rostopic </span><span style="color: rgb(170, 4, 249);">info /pose</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="9F74C923" data-testid="output_4" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="104" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">Type: geometry_msgs/Twist
 
Publishers:
* /node_1 (http://LAPTOP-TG3AQJDL:14260/)
 
Subscribers:
* /node_2 (http://LAPTOP-TG3AQJDL:14266/)</div></div></div></div></div><div  class = 'S8'><span>使用 </span><span style=' font-family: monospace;'></span><a href = "docid:ros_ref.bupf5_j_4"><span style=' font-family: monospace;'>rosnode</span></a><span style=' font-family: monospace;'> info &lt;</span><span style=' font-style: italic; font-family: monospace;'>nodename&gt;</span><span> 获取有关特定节点的信息。 下面的命令显示 </span><span style=' font-family: monospace;'>node_1 发布到</span><span> </span><span style=' font-family: monospace;'>/pose</span><span> and</span><span> </span><span style=' font-family: monospace;'>/rosout</span><span> 主题 并订阅 </span><span style=' font-family: monospace;'>/scan</span><span> 主题.</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >rosnode </span><span style="color: rgb(170, 4, 249);">info /node_1</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="4B4A4838" data-testid="output_5" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="205" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">Node: [/node_1]
URI: [http://LAPTOP-TG3AQJDL:14260/]
 
Publications (3 Active Topics): 
 * /pose
 * /rosout
 * /tf
 
Subscriptions (1 Active Topics): 
 * /scan
 
Services (2 Active): 
 * /node_1/get_loggers
 * /node_1/set_logger_level</div></div></div></div></div><h2  class = 'S5'><span>Services</span></h2><div  class = 'S1'><span>ROS服务为ROS网络上的过程调用提供了一种机制。 </span><span style=' font-style: italic;'>service client</span><span> 发送请求消息 </span><span style=' font-style: italic;'>service server</span><span>, </span><span style=' font-style: italic;'>service server </span><span>处理请求中的信息并返回响应消息 (see</span><span> </span><a href = "docid:ros_ug.mw_70dbf089-5821-4e67-b96f-f659aea10c0c"><span>Call and Provide ROS Services</span></a><span>).</span></div><div  class = 'S1'><span>使用 </span><span style=' font-family: monospace;'></span><a href = "docid:ros_ref.bupf5_j_7"><span style=' font-family: monospace;'>rosservice</span></a><span style=' font-family: monospace;'> list</span><span> 查看ROS网络中所有可用的服务服务器。 下面的命令显示有两个服务 </span><span>(</span><span style=' font-family: monospace;'>/add</span><span> and</span><span> </span><span style=' font-family: monospace;'>/reply</span><span>)可用。</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >rosservice </span><span style="color: rgb(170, 4, 249);">list</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="4175FCA8" data-testid="output_6" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="147" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">/add
/matlab_global_node_08796/get_loggers
/matlab_global_node_08796/set_logger_level
/node_1/get_loggers
/node_1/set_logger_level
/node_2/get_loggers
/node_2/set_logger_level
/node_3/get_loggers
/node_3/set_logger_level
/reply</div></div></div></div></div><div  class = 'S8'><span>使用 </span><span style=' font-family: monospace;'>rosservice info </span><span style=' font-style: italic; font-family: monospace;'>&lt;servicename&gt;</span><span> 获取有关特定服务的信息。</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >rosservice </span><span style="color: rgb(170, 4, 249);">info /add</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="D2AB5D8E" data-testid="output_7" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="61" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">Node: /node_3
URI: rosrpc://LAPTOP-TG3AQJDL:14271
Type: roscpp_tutorials/TwoInts
Args: a b</div></div></div></div></div><h2  class = 'S5'><span>Messages</span></h2><div  class = 'S1'><span>发布者(Publishers)、订阅者(subscribers)和服务(services)使用ROS消息来交换信息。 每个ROS消息都有一个相关的消息类型( </span><span style=' font-style: italic;'>message type)</span><span> ,它定义了该消息中的数据类型和信息布局 (See</span><span> </span><a href = "docid:ros_ug.mw_2b4c1056-431d-4413-a812-7cd07f4d9a36"><span>Work with Basic ROS Messages</span></a><span>).</span></div><div  class = 'S1'><span>使用 </span><span style=' font-family: monospace;'></span><a href = "docid:ros_ref.bupf5_j_14"><span style=' font-family: monospace;'>rostopic</span></a><span style=' font-family: monospace;'> type</span><span> </span><span style=' font-style: italic; font-family: monospace;'>&lt;topicname&gt; </span><span>查看主题(topic)使用的消息类型。 下面的命令显示 </span><span style=' font-family: monospace;'>/pose</span><span> 主题使用类型为 </span><span style=' font-family: monospace;'>geometry_msgs/Twist。</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >rostopic </span><span style="color: rgb(170, 4, 249);">type /pose</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="0F34875A" data-testid="output_8" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="18" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">geometry_msgs/Twist</div></div></div></div></div><div  class = 'S8'><span>使用 </span><span style=' font-family: monospace;'></span><a href = "docid:ros_ref.bupf5_j_3"><span style=' font-family: monospace;'>rosmsg</span></a><span style=' font-family: monospace;'> show</span><span> </span><span style=' font-style: italic; font-family: monospace;'>&lt;messagetype&gt; </span><span>查看消息类型的属性。 The</span><span> </span><span style=' font-family: monospace;'>geometry_msgs/Twist</span><span> 消息类型有两个属性，线性（</span><span style=' font-family: monospace;'>Linear</span><span>）和角度（</span><span style=' font-family: monospace;'>Angular</span><span>）。</span><span>  每个属性都是 </span><span style=' font-family: monospace;'>geometry_msgs/Vector3 </span><span>类型的消息,  而</span><span style=' font-family: monospace;'>geometry_msgs/Vector3</span><span>又有三个double类型的消息。</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >rosmsg </span><span style="color: rgb(170, 4, 249);">show geometry_msgs/Twist</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="91309C2F" data-testid="output_9" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="46" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">% This expresses velocity in free space broken into its Linear and Angular parts.
Vector3  Linear
Vector3  Angular</div></div></div></div><div class="inlineWrapper outputs"><div  class = 'S10'><span style="white-space: pre"><span >rosmsg </span><span style="color: rgb(170, 4, 249);">show geometry_msgs/Vector3</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="8F5AB786" data-testid="output_10" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="147" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">% This represents a vector in free space. 
% It is only meant to represent a direction. Therefore, it does not
% make sense to apply a translation to it (e.g., when applying a 
% generic rigid transformation to a Vector3, tf2 will only apply the
% rotation). If you want your data to be translatable too, use the
% geometry_msgs/Point message instead.

double X
double Y
double Z</div></div></div></div></div><div  class = 'S8'><span>使用 </span><span style=' font-family: monospace;'>rosmsg list </span><span>查看MATLAB中可用的消息类型的完整列表。</span></div><h2  class = 'S5'><span>Shut Down ROS Network</span></h2><div  class = 'S1'><span>使用 </span><span style=' font-family: monospace;'>exampleHelperROSShutDownSampleNetwork</span><span> 从ROS网络中删除示例节点（nodes）、发布者（publishers）和订阅者（subscribers）。仅当先前使用</span><span style=' font-family: monospace;'>exampleHelperROSStartSampleNetwork</span><span>创建示例网络时，才需要此命令。</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S9'><span style="white-space: pre"><span >exampleHelperROSShutDownSampleNetwork</span></span></div></div></div><div  class = 'S8'><span>在MATLAB中使用 </span><span style=' font-family: monospace;'></span><a href = "docid:ros_ref.bupf5_j_8"><span style=' font-family: monospace;'>rosshutdown</span></a><span> 关闭 ROS network 。这将关闭由</span><a href = "docid:ros_ref.bupf5_j_1"><span style=' font-family: monospace;'>rosinit</span></a><span> 启动的ROS主节点（master）并删除全局节点（global node）。 一旦你完成与ROS网络的工作，建议使用 </span><span style=' font-family: monospace;'>rosshutdown</span><span> 程序。</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >rosshutdown</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="CAF2A0D0" data-testid="output_11" style="width: 716px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement eoOutputContent" data-width="686" data-height="32" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">Shutting down global node /matlab_global_node_08796 with NodeURI http://LAPTOP-TG3AQJDL:14250/
Shutting down ROS master on http://192.168.118.1:11311.</div></div></div></div></div><h2  class = 'S5'><span>Next Steps</span></h2><ul  class = 'S2'><li  class = 'S3'><a href = "docid:ros_ug.mw_d625a603-7f37-4925-9470-2de734937434"><span>Connect to a ROS Network</span></a></li></ul><div  class = 'S1'><span style=' font-style: italic;'>Copyright 2014-2015 The MathWorks, Inc.</span></div><div  class = 'S1'></div>
<br>
<!-- 
##### SOURCE BEGIN #####
%% Get Started with ROS
% 机器人操作系统（Robot Operating System，ROS）是一个通信接口，它使机器人系统的不同部分能够相互发现，并在它们之间发送和接收数据。MATLAB®支持具有函数库的ROS，使您能够与启用ROS的物理机器人或机器人仿真器（如Gazebo®）交换数据。
% 
% 此示例介绍如何：
%% 
% * 在 MATLAB中设置ROS
% * 获取有关ROS网络中功能的信息
% * 获取ROS messages的信息
%% ROS Terminology
%% 
% * ROS网络(_ROS network)_包括通过ROS通信的机器人系统的不同部分（例如计划者planner或相机接口）。网络可以分布在多台机器上。
% * ROS主机(_ROS master_ )负责协调ROS网络的不同部分。它由_Master URI_（统一资源标识符）标识，该URI指定运行主服务器的计算机的主机名或IP地址。
% * ROS节点(_ROS node_)包含相关ROS功能的集合（例如发布者publishers、订阅者subscribers和服务services）。ROS网络可以有许多ROS节点nodes。
% * 发布者_Publishers_、订阅者_subscribers_和服务_services_是处理数据的不同类型的ROS实体。他们用信息交换数据_messages_。
% * 发布者publisher向特定主题_topic_发送消息（如“odometry”），该主题的订阅者subscribers接收这些消息。一个主题可以与多个发布者和订阅者关联。
%% 
% 有关更多信息，请参阅ROS网站上的<docid:ros_gs.mw_79ccfff3-bdbd-46d8-899f-e5add5a50fad Robot 
% Operating System (ROS)>（ROS）和概念<https://wiki.ros.org/ROS/Concepts Concepts>部分。
%% Initialize ROS Network
% 使用 <docid:ros_ref.bupf5_j_1 |rosinit|> 初始化ROS。默认情况下，|rosinit|在MATLAB中创建ROS主节点(_ROS 
% master)_,并启动连接到该主节点(_ROS master)_的全局节点(_global node_)。全局节点(_ROS master)_被其他ROS函数自动使用。

rosinit
%% 
% 使用<docid:ros_ref.bupf5_j_4 |rosnode|> |list|查看ROS网络中的所有节点。注意，唯一可用的节点是|rosinit|创建的全局节点(global 
% node)。

rosnode list
%% 
% 使用|exampleHelperROSCreateSampleNetwork|向ROS网络填充三个附加节点以及示例发布者(publishers)和订阅者(subscribers)。

exampleHelperROSCreateSampleNetwork
%% 
% 再次使用 rosnode |list| 查看三个新节点 (|node_1|, |node_2,| and |node_3|)。

rosnode list
%% 
% 该图显示了ROS网络的当前状态。MATLAB全局节点(global node)已断开连接，因为它当前没有任何发布者（publishers）、订阅者（subscribers）或服务（services）。
% 
% 
%% Topics
% 使用<docid:ros_ref.bupf5_j_14 |rostopic|>列表查看ROS网络中的可用主题。有三个活动主题：|/pose|, |/rosout|, 
% and |/scan|。默认的日志主题，|rosout|，总是出现在ROS网络中。其他两个主题是作为示例网络的一部分创建的。

rostopic list
%% 
% 使用 |rostopic info| |_<topicname>_|获取有关特定主题的特定信息。 面的命令显示 |/node_1| 发布 (发送消息到) 
% the |/pose| topic, and |/node_2| 订阅 (从接收消息) to that topic. 有关详细信息，请参阅<docid:ros_ug.mw_fa34dc6f-351e-4ab5-8680-46563496814b 
% Exchange Data with ROS Publishers and Subscribers。>

rostopic info /pose
%% 
% 使用 <docid:ros_ref.bupf5_j_4 |rosnode|> |info <_nodename>_| 获取有关特定节点的信息。 下面的命令显示 
% |node_1 发布到| |/pose| and |/rosout| 主题 并订阅 |/scan| 主题.

rosnode info /node_1
%% Services
% ROS服务为ROS网络上的过程调用提供了一种机制。 _service client_ 发送请求消息 _service server_, _service 
% server_ 处理请求中的信息并返回响应消息 (see <docid:ros_ug.mw_70dbf089-5821-4e67-b96f-f659aea10c0c 
% Call and Provide ROS Services>).
% 
% 使用 <docid:ros_ref.bupf5_j_7 |rosservice|> |list| 查看ROS网络中所有可用的服务服务器。 下面的命令显示有两个服务 
% (|/add| and |/reply|)可用。

rosservice list
%% 
% 使用 |rosservice info _<servicename>_| 获取有关特定服务的信息。

rosservice info /add
%% Messages
% 发布者(Publishers)、订阅者(subscribers)和服务(services)使用ROS消息来交换信息。 每个ROS消息都有一个相关的消息类型( 
% _message type)_ ,它定义了该消息中的数据类型和信息布局 (See <docid:ros_ug.mw_2b4c1056-431d-4413-a812-7cd07f4d9a36 
% Work with Basic ROS Messages>).
% 
% 使用 <docid:ros_ref.bupf5_j_14 |rostopic|> |type| |_<topicname>_| 查看主题(topic)使用的消息类型。 
% 下面的命令显示 |/pose| 主题使用类型为 |geometry_msgs/Twist。|

rostopic type /pose
%% 
% 使用 <docid:ros_ref.bupf5_j_3 |rosmsg|> |show| |_<messagetype>_| 查看消息类型的属性。 
% The |geometry_msgs/Twist| 消息类型有两个属性，线性（|Linear|）和角度（|Angular|）。  每个属性都是 |geometry_msgs/Vector3| 
% 类型的消息,  而|geometry_msgs/Vector3|又有三个double类型的消息。

rosmsg show geometry_msgs/Twist
rosmsg show geometry_msgs/Vector3
%% 
% 使用 |rosmsg list| 查看MATLAB中可用的消息类型的完整列表。
%% Shut Down ROS Network
% 使用 |exampleHelperROSShutDownSampleNetwork| 从ROS网络中删除示例节点（nodes）、发布者（publishers）和订阅者（subscribers）。仅当先前使用|exampleHelperROSStartSampleNetwork|创建示例网络时，才需要此命令。

exampleHelperROSShutDownSampleNetwork
%% 
% 在MATLAB中使用 <docid:ros_ref.bupf5_j_8 |rosshutdown|> 关闭 ROS network 。这将关闭由<docid:ros_ref.bupf5_j_1 
% |rosinit|> 启动的ROS主节点（master）并删除全局节点（global node）。 一旦你完成与ROS网络的工作，建议使用 |rosshutdown| 
% 程序。

rosshutdown
%% Next Steps
%% 
% * <docid:ros_ug.mw_d625a603-7f37-4925-9470-2de734937434 Connect to a ROS Network>
%% 
% _Copyright 2014-2015 The MathWorks, Inc._
% 
%
##### SOURCE END #####
-->
</div></body></html>